package com.neusoft.kora.refactor.sd;

import java.util.Arrays;
import java.util.List;

/**
 * <p/>com.neusoft.kora.refactor.sd
 * <p/>Restructure
 * <p/>Created by chenxiangning on 15-11-9.
 */
public class SubstituteAlgorithm {

    String FoundPerson(String[] people) {

        for (int i = 0; i < people.length; i++) {

            if (people[i].equals("don")) {
                return "don";

            }

            if (people[i].equals("john")) {
                return "john";

            }

            if (people[i].equals("kent")) {
                return "kent";

            }

        }

        return null;
    }

    String FoundPerson_(String[] people) {

        List<String> peopleList = Arrays.asList(people);

        for (int i = 0; i < peopleList.size(); i++) {
            if(peopleList.contains(people[i])){
                return people[i];
            }
        }
        return null;
    }






}
